package com.demo.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.alibaba.fastjson.JSONObject;

public class PrintUtil {
	private static Logger logger = LoggerFactory.getLogger(PrintUtil.class);

	public static Date formart(String dateStr) {
		try {
			Person person = new Person("abc", 12);
			if (logger.isDebugEnabled()) {
			}
			logger.debug("args[{}]", JSONObject.toJSONString(person));
			logger.info("---");
			return new SimpleDateFormat("yyyyMMdd").parse(dateStr);
		} catch (ParseException e) {
			// 异常记为error
			// System.out.print(e);XXX
			// e.printStackTrace();XXX
			// logger.error(e.getMessage());XXX
			// logger.error(e + "");
			logger.error("args:" + dateStr, e);
		}
		return null;
	}

	public static int test001(int a, int b) throws Exception {
		if (a == 1) {
			return 0;

		}
		if (b == 0) {
			logger.debug(b + "");
			throw new Exception();
		}
		return 1;
	}

}
